<template>
  <div>
      <div style="width:400px;padding:12px;margin:100px auto;border:1px solid #ddd;">
          <el-form ref="form" :model="form" label-position="top" label-width="80px">
            <el-form-item label="用户名">
                <el-input v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input type="password" v-model="form.pass"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="save">立即创建</el-button>
                <el-button type="primary" @click="getPlanMonth">立即创建22</el-button>
            </el-form-item>
        </el-form>
      </div>
  </div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";

@Component({
    name: "login",
})
export default class Login extends Vue {
    private form: any = {
        name: 'admin',
        pass: 'admin'
    }
    getPlanMonth()  {
        this.$http.get('api/product/page',  {
            start:  this.$moment().subtract('months', 1).format('YYYY-MM-DD HH:mm:ss'),
            end: this.$moment().format('YYYY-MM-DD HH:mm:ss')
        }).then(res => {
            debugger
        })
    }
    send(){
        this.$http.get('api/user/page').then(res  => {
            debugger
        })
    }

    save(){
        this.$http.post('api/plan/add',{
            dept:'生产部',
            producer:'付玉晶',
            assembly:'喷漆大线',
            take:'2020-09-13',
            products:[
                {
                    figurenumber: 'V3',
                    component: '车头',
                    quantity: 32,
                    suspend: 12,
                    film: 'A表面:90um',
                    color: '电泳-中涂-高温军绿',
                    dayshift: '',
                    nightshift: '',
                    remark: ''
                }
            ],
            title:'生产任务单',
        }).then(res  => {
            debugger
        })
    }
}
</script>
